export default {
	data() {
		return {
			imgSrc: '/static/imgs',
			background: 'transparent',
			page: 1,
			limit: 10,
			loadend: false, //是否加载完毕
			// loading: false, //是否加载中
			// loadTitle: '加载更多', //提示语
			inputMaxlength: 10
			
		}
	},
	onPageScroll(e) {
		if (e.scrollTop > 20) {
			this.background = '#fff'
		} else {
			this.background = 'transparent'
		}

	},
	methods: {
		// 限制数字输入框小数点后两位
		checkNum(e) {
			var promise = new Promise((resolve, reject) => {
				let value = e.detail.value;
				let dot = value.indexOf('.'); //包含小数点
				let reg = /^[0-9]+$/; //正整数
				// 存在小数点
				if (dot > -1) {
					if (value.indexOf(".") == 0) {
						//'首位小数点情况'
						value = value.replace(/[^$#$]/g, "0.");
						value = value.replace(/\.{2,}/g, ".");
					} else if (!(/^(\d?)+(\.\d{0,2})?$/.test(value))) {
						// 多个小数点情况
						value = value.substring(0, value.length - 1)
					}

					this.inputMaxlength = dot + 3; //长度是小数点后两位
				}
				resolve(value)

			})

			return promise

		},
		toLogin() {
			this.$u.route(`/pages/auth/mplogin`)
		},
		scan() {
			return new Promise((resolve, reject) => {
				uni.scanCode({
					success: function(res) {
						// that.QueryDto.AbroadExpressNo = res.result
						resolve(res.result)
					},
					fail: (err => {
						console.log(err)
					})
				});
			})

		},
		
	}

}